import {defineStore} from 'pinia'
import {reactive, ref} from 'vue'
//关于登录模态框的全局状态
export const useUserStore = defineStore(
    "user",
    () => {
        const userInfo = ref(null)
        // const nickName = ref('')
        // const id = ref(null)
        // const headPic = ref('')
        // const email = ref('')
        // const level = ref(0)
        // const time = ref('')

        // /**
        //  * 
        //  * @param {Number} u_id 
        //  * @param {String} u_email 
        //  * @param {Stirng} u_nickName 
        //  * @param {Number} u_level 
        //  * @param {Stirng} u_time 
        //  * @param {Stirng} u_headPic 
        //  */
        // const setUserInfo = (u_id,u_email,u_nickName,u_level,u_time,u_headPic)=>{
        //     id.value = u_id
        //     email.value = u_email
        //     nickName.value = u_nickName
        //     level.value = u_level
        //     time.value = u_time
        //     headPic.value = u_headPicid
        // }
        const setUserInfo = (u_userInfo)=>{
            userInfo.value = u_userInfo
        }

        return {userInfo,setUserInfo}
    },
    // 自定义存储方式
    {
        persist: {
            storage: localStorage,//本地存储
        }
    }
)
